package c.h.a.j0;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Build.VERSION;
import c.b.a.a.a;
import com.huawei.hms.analytics.core.crypto.AesCipher.AesLen;
import com.liuzh.deviceinfo.DeviceInfoApp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Objects;

/* compiled from: lambda */
public final /* synthetic */ class e implements Runnable {
    public final /* synthetic */ i0 a;

    public /* synthetic */ e(i0 i0Var) {
        this.a = i0Var;
    }

    public final void run() {
        i0 i0Var = this.a;
        Objects.requireNonNull(i0Var);
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ArrayList arrayList3 = new ArrayList();
        for (PackageInfo packageInfo : DeviceInfoApp.c.b().getInstalledPackages(AesLen.ROOTKEY_COMPONET_LEN)) {
            long longVersionCode;
            String charSequence = packageInfo.applicationInfo.loadLabel(DeviceInfoApp.c.b()).toString();
            String str = packageInfo.applicationInfo.packageName;
            if (VERSION.SDK_INT >= 28) {
                longVersionCode = packageInfo.getLongVersionCode();
            } else {
                longVersionCode = (long) packageInfo.versionCode;
            }
            long j = longVersionCode;
            StringBuilder i = a.i(DeviceInfoApp.c.getString(2131690546), ": ");
            i.append(packageInfo.versionName);
            i.append("(");
            i.append(j);
            i.append(")");
            String stringBuilder = i.toString();
            ApplicationInfo applicationInfo = packageInfo.applicationInfo;
            c.h.a.d0.a aVar = new c.h.a.d0.a(applicationInfo, charSequence, str, stringBuilder, j, applicationInfo.sourceDir);
            boolean z = true;
            if ((applicationInfo.flags & 1) != 1) {
                z = false;
            }
            aVar.h = z;
            if (z) {
                arrayList2.add(aVar);
            } else {
                arrayList.add(aVar);
            }
            arrayList3.add(aVar);
        }
        j0 j0Var = new j0(i0Var);
        Collections.sort(arrayList, j0Var);
        Collections.sort(arrayList2, j0Var);
        Collections.sort(arrayList3, j0Var);
        c.h.a.m0.p.a.b(new a(i0Var, arrayList2, arrayList, arrayList3));
    }
}
